package com.cyx.mapper;

import com.cyx.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from user where id=#{id}")
    User getUserById(@Param("id") int id);

    @Select("select * from user")
    List<User> getUserList();
    @Select("select * from user limit #{startIndex},#{pageSize}  ")
    List<User> getUserListByPaging(@Param("startIndex") int startIndex,
                                   @Param("pageSize") int pageSize);
    @Insert("insert into user(id,name,pwd) values(#{id} ,#{name} ,#{pwd} )")
    int addUser(User user);

    @Update("update USER set name=#{name} ,pwd=#{pwd} where id=#{id}")
    int updateUser(User user);

    @Delete("delete from user where id=#{id} ")
    int deleteUser(int id);

}
